package org.ctstudio.oa.duty.dao;

import java.time.LocalTime;
import java.util.List;

import org.apache.ibatis.annotations.Arg;
import org.apache.ibatis.annotations.ConstructorArgs;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.ctstudio.common.datatype.TimeFragment;
import org.ctstudio.oa.duty.bean.DutyDefine;

@Mapper
public interface DutyDefineMapper {
  @SelectProvider(type = DutyDefineSql.class, method = "getWorkTime")
  @ConstructorArgs({ @Arg(column = "startTime", javaType = LocalTime.class), @Arg(column = "endTime", javaType = LocalTime.class) })
  TimeFragment getWorkTime();

  @SelectProvider(type = DutyDefineSql.class, method = "getBreaks")
  @ConstructorArgs({ @Arg(column = "startTime", javaType = LocalTime.class), @Arg(column = "endTime", javaType = LocalTime.class) })
  List<TimeFragment> getBreaks();

  @Select("SELECT name,startTime,endTime,flexStartTime FROM duty.onDutyDef LIMIT 1")
  DutyDefine getDutyDefine();
}
